package com.company;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * @author jrue
 * @version 1.0
 * @date 2020/3/23 19:42
 */
public class Main63 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] times = s.split(",");
        int[] timesValue = new int[times.length];

        for (int i = 0; i < times.length; i++) {
            timesValue[i] = Integer.valueOf(times[i]);
        }

        ArrayList<Integer> res = new ArrayList<>();

        res.add(timesValue[0] - 30);

        for (int i = 0; i < (timesValue.length)/2; i++) {
            int p = 2 * i;
            int q = 2 * i + 1;
            if (i == 0) continue;
            if (timesValue[p] - timesValue[p - 1] >= 120) {
                res.add(timesValue[p - 1] + 30);
                res.add(timesValue[p] - 30);
            }
            //System.out.println(timesValue[p] + " " + timesValue[q]);


        }

        res.add(timesValue[times.length - 1] + 30);

        for (int i = 0; i < res.size(); i++) {
            if ( i == res.size() - 1) System.out.print(res.get(i));
            else System.out.print(res.get(i) + ",");
        }

    }

}
